package com.myGis.persistence;

import org.hibernate.Session;


public class PersistenceData implements IPersistenceData {

	private Session session;

	public PersistenceData(Session session) {
		this.session = session;
	}
	
	@Override
	public <T> void save(T o) {
		try {
			//session.beginTransaction();
			session.save(o);
			//session.getTransaction().commit();
		} catch (Exception e) {
			System.err.println("error exception when adding new item to table"
					+ e);
		}
		
	}

	@Override
	public <T> void update(T o) {
		try {
			//session.beginTransaction();
			session.update(o);
			//session.getTransaction().commit();
		} catch (Exception e) {
			System.err.println("error exception when udate new item to table"
					+ e);
		}
		
	}

	@Override
	public <T> void delete(T o) {
		try {
			//session.beginTransaction();
			session.delete(o);
			///session.getTransaction().commit();
		} catch (Exception e) {
			System.err.println("error exception when delete new item to table"
					+ e);
		}
	}
}
